package com.example.pinyin;

import java.util.List;

import com.example.dao.LearnDao;
import com.example.dao.impl.LearnDaoImpl;
import com.example.model.LEARN;
import com.example.provider.LearnAdapter;
import com.example.utils.BaseUI;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class Learn extends BaseUI {
	
	private ListView mLv;
	public List<LEARN> List;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.learn);
		lc();
		findView();
		
	}
	
	@Override
	protected void onStart() {
		super.onStart();
		useView();
	}
	
	private void findView(){
		mLv=(ListView) findViewById(R.id.lv_learn);
	}
	
	private void useView(){
		getAdapter();
		mLv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Intent i = new Intent(Learn.this,LearnText.class);
				startActivity(i);
			}
		});
		
	}
	
	public void getAdapter(){
		LearnDao learn = new LearnDaoImpl();
		List=learn.getList(this);
		LearnAdapter adapter = new LearnAdapter(this, List);
		mLv.setAdapter(adapter);	
	}
	
	class buttonListener implements OnClickListener{

		@Override
		public void onClick(View v) {
			
		}

		
	}
}
